
#include "BacktrackManager.h"
#include "State.h"

BacktrackManager::BacktrackManager()
    : history_(std::stack<State*>())
{

}

BacktrackManager::~BacktrackManager()
{
  while (!history_.empty()) {
    State* s = history_.top();
    history_.pop();
    delete s;
  }
}

State* BacktrackManager::GetState()
{
  State* cur_state = history_.top();
  history_.pop();
  return cur_state;
}

void BacktrackManager::AddState(State* s)
{
  history_.push(s);
}
